package com.martin.lib_base.utils

object FishUtil {
    /**
     * 从多个数字中筛选最大的数字
     */
    fun <T : Comparable<T>> max(vararg nums: T) : T {
        if (nums.isEmpty()) throw RuntimeException("Params can not be empty.")
        var maxNum = nums[0]
        for (num in nums) {
            if (num > maxNum) {
                maxNum = num
            }
        }
        return maxNum
    }


    var lastClickTime: Long = 0
    val INTEGER_800: Int = 800
    /**
     * 防止多次点击(返回是否可以点击)
     * @return
     */
    fun isClickable(): Boolean {
        val time = System.currentTimeMillis()
        val timeD = time - lastClickTime
        if (timeD in 1..<INTEGER_800) {
            return false
        }
        lastClickTime = time
        return true
    }

}